package com.ruoyi.stock.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.stock.mapper.StockMemberRuleMapper;
import com.ruoyi.stock.domain.StockMemberRule;
import com.ruoyi.stock.service.IStockMemberRuleService;

/**
 * 会员规则Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-12-30
 */
@Service
public class StockMemberRuleServiceImpl implements IStockMemberRuleService 
{
    @Autowired
    private StockMemberRuleMapper stockMemberRuleMapper;

    /**
     * 查询会员规则
     * 
     * @param id 会员规则主键
     * @return 会员规则
     */
    @Override
    public StockMemberRule selectStockMemberRuleById(Long id)
    {
        return stockMemberRuleMapper.selectStockMemberRuleById(id);
    }

    /**
     * 查询会员规则列表
     * 
     * @param stockMemberRule 会员规则
     * @return 会员规则
     */
    @Override
    public List<StockMemberRule> selectStockMemberRuleList(StockMemberRule stockMemberRule)
    {
        return stockMemberRuleMapper.selectStockMemberRuleList(stockMemberRule);
    }

    /**
     * 新增会员规则
     * 
     * @param stockMemberRule 会员规则
     * @return 结果
     */
    @Override
    public int insertStockMemberRule(StockMemberRule stockMemberRule)
    {
        stockMemberRule.setCreateTime(DateUtils.getNowDate());
        return stockMemberRuleMapper.insertStockMemberRule(stockMemberRule);
    }

    /**
     * 修改会员规则
     * 
     * @param stockMemberRule 会员规则
     * @return 结果
     */
    @Override
    public int updateStockMemberRule(StockMemberRule stockMemberRule)
    {
        stockMemberRule.setUpdateTime(DateUtils.getNowDate());
        return stockMemberRuleMapper.updateStockMemberRule(stockMemberRule);
    }

    /**
     * 批量删除会员规则
     * 
     * @param ids 需要删除的会员规则主键
     * @return 结果
     */
    @Override
    public int deleteStockMemberRuleByIds(Long[] ids)
    {
        return stockMemberRuleMapper.deleteStockMemberRuleByIds(ids);
    }

    /**
     * 删除会员规则信息
     * 
     * @param id 会员规则主键
     * @return 结果
     */
    @Override
    public int deleteStockMemberRuleById(Long id)
    {
        return stockMemberRuleMapper.deleteStockMemberRuleById(id);
    }
}
